package com.wanbangee.marksystem.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wanbangee.marksystem.service.ScoreAndAnswerSheetService;

@RestController
public class ScoreAndAnswerSheetController {
	
	@Autowired
	private ScoreAndAnswerSheetService scoreAndAnswerSheetService;
	
	/**教师讲卷-成绩与答案
	 * 
	 * 查询学生对应的试卷url
	 * @param examId
	 * @param stuId
	 * @param subId
	 * @return
	 */
	@GetMapping("/scoreAndAnswerSheet/selectStuExamaSheetUrl")
	public Map<String, Object> selectStuExamaSheetUrl(Integer examId,Integer stuId,Integer subId){
		//用来存储提示信息，和状态码，数据
		Map<String, Object> responseMap = new HashMap<String, Object>();
		
		//调用scoreAndAnswerSheetService中selectScoreSubsectionByExamIdAndSubId方法查询分数段指标表
		String url = scoreAndAnswerSheetService.selectStuExamaSheetUrl(examId, stuId, subId);
		
		 
		if(url == null || url.equals("")) {  //查询失败
			responseMap.put("code", 10013);
			responseMap.put("msg", "未查询到该学生试卷信息");
		}else {
			//将查询到的科目信息放入map中返回给前端
			responseMap.put("url", url);
			//返回状态码1001，提示信息：接口成功
			responseMap.put("code", 1001);
			responseMap.put("msg", "接口成功");
		}
		return responseMap;
	}
	
}
